package com.tracy.life.discovery.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.squareup.picasso.Picasso;
import com.tracy.life.R;
import com.tracy.life.bean.SpecialBean;

import java.util.List;

/**
 * Created by asus on 2016/7/20.
 * GridView 的适配器
 */
public class GridViewAdapter extends BaseAdapter {
    private Context mContent;
    private List<String> mUrlList;


    public GridViewAdapter(Context mContent, List<String> mUrlList) {
        this.mContent = mContent;
        this.mUrlList = mUrlList;
    }

    @Override
    public int getCount() {
        return mUrlList == null ? 0 : mUrlList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(mContent).inflate(R.layout.item_gridvew, null);
        ImageView imageView = (ImageView) view.findViewById(R.id.img_cardview);
        Picasso.with(mContent).load(mUrlList.get(position)).into(imageView);
        return view;
    }

}
